package querydatabaseselection.selector;

import java.util.ArrayList;
import java.util.List;

import distributedRE.model.DistributedREModel;

import querydatabaseselection.pair.QueryDatabasePair;

public class FirstKDescendingOrder extends QueryDatabaseSelector {

	private int K;

	public FirstKDescendingOrder(int K){
		this.K = K;
	}
	
	protected List<QueryDatabasePair> select(
			ArrayList<QueryDatabasePair> calculatedValues, DistributedREModel dREModel) {
		
		return calculatedValues.subList(0, Math.min(calculatedValues.size(),K));
		
	}

	protected boolean isDescending() {
	
		return true;

	}

	public String toString(){
		return "First " + K + " in descending order";
	}

}
